-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Test #1
base: main
Are you sure you want to change the base?
Test #1
Conversation
src/features/voyage-planner.tsx
Outdated
const [selectedPort, setSelectedPort] = useState(""); | ||
const [addedPorts, setAddedPorts] = useState<Port[]>([]); | ||
const [offset, setOffset] = useState(0); | ||
const [fetchData, setFetchData] = useState([]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This data is stored in the Redux store. Why are you duplicating it here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for your feedback John. I removed the duplicates from here. Please check the latest changes.
src/features/voyage-planner.tsx
Outdated
} | ||
function VoyagePlanner(params: VoyagePlannerParams) { | ||
const [selectedPort, setSelectedPort] = useState(""); | ||
const [addedPorts, setAddedPorts] = useState<Port[]>([]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added ports are in the redux store. Where are you duplicating here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I also removed here. Please check the latest changes.
src/features/voyage-planner.tsx
Outdated
<h2>Voyage</h2> | ||
{addedPorts && | ||
addedPorts.map((item, key) => { | ||
return <div key={key}>{item.name}</div>; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Low effort here. Remove port functionality? Re-arrange? No styling
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I removed this part as well.
src/features/voyage-planner.tsx
Outdated
.getState() | ||
.ports.ports.filter((item: Port) => item.name === selectedPort); | ||
dispatch(addPorts(portTobeAdded[0])); | ||
setAddedPorts(store.getState().voyage.ports); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missed requirement to calculate estimated time of arrival, distance travelled.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I also added the functionality for distance and estimated time of arrival here. Please check the latest code.
src/services/ports-reducer.ts
Outdated
export function portsReducer(state = initialState, action: AnyAction): PortsState { | ||
switch (action.type) { | ||
case 'SETPORTACTION': | ||
return { ...state, ports: action.portList } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are doing a paginated fetch - the ports should be appended, not replaced
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I solved the issue here. Please check the latest changes which I made and let me know any further improvements
No description provided.